var RenameAssistant = function() {
}

RenameAssistant.prototype.run = function(future) {
	var args = this.controller.args;
	if((!args.fromPath) || (!args.toPath)) {
		setError(future, "Argument count wrong; specify fromPath and toPath");
	} else {
		path.exists(args.fromPath, function(fromexists) {
			if(!fromexists) {
				setError(future, "fromPath does not exist");
			} else {
				path.exists(args.toPath, function(toexists) {
					if(toexists) {
						setError(future, "toPath already exists");
					} else {
						fs.rename(args.fromPath, args.toPath, function(e) {
							future.result = {
								done:	e === undefined
							};
						});
					}
				});
			}
		});
	}
}
